package com.jinzecloud.reportapproval.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jinzecloud.reportapproval.enums.StateEnum;
import com.jinzecloud.reportapproval.enums.TableEnums;
import com.jinzecloud.reportapproval.utils.AuditUtil;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 验样单
 *
 * @author æ­å°
 * @email 1971240051@qq.com
 * @date 2024-12-03 16:18:45
 */
@Data
@TableName("sample_inspection")
@Accessors(chain = true)
public class SampleInspection implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String projectCode;

    /**
     * 样机型号·名称
     */
    private String prototypeTrademark;
    /**
     * 样品等级
     */
    private String sampleGrade;
    /**
     * 抽样基数
     */
    private String sampleNumber;
    /**
     * 抽样数量
     */
    private String samplingBasicNumber;
    /**
     * 封签类型（纸封签、封签、印封签）
     */
    private String sampleType;
    /**
     * 封签部位
     */
    private String sealingPosition;
    /**
     * 抽样方法
     */
    private String sealMethod;
    /**
     * 样品状态
     */
    private String sampleStatus;
    /**
     * 验样地点
     */
    private String sampleSite;
    /**
     * 样品存放地点
     */
    private String sampleLocation;
    /**
     * 鉴定依据
     */
    private String inspectionBasis;
    /**
     * 备注
     */
    private String remark;
    /**
     * 样品单位负责人
     */
    private String departmentHead;
    /**
     * 验样人
     */
    private String sampler;
    /**
     * 抽样日期
     */
    private String sampleDate;
    /**
     * 审核意见
     */
    private String auditOpinion;

    /**
     * 审核时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date auditDate;

    /**
     * 生成word地址
     */
    private String wordPath;

    /**
     * 生成pdf地址
     */
    private String pdfPath;

    /**
     * 创建用户id
     */
    private Integer createdUserId;

    /**
     * 状态
     */
    private Integer state;

    @TableField(exist = false)
    private String stateText;

    public String getStateText() {
        return AuditUtil.getStateText(TableEnums.SAMPLE_SHEET.getTableName(), state).getDesc();
    }

    @TableField(exist = false)
    private List<SampleDetails> sampleDetailsList;

    @TableField(exist = false)
    private List<SampleSheetWorkplaceDetail> sampleInspectionWorkplaceDetailList;

}
